home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-22 | 2.2 KB | 51 lines | [TEXT/MPS ] |
- Macintosh
- Sample Code Notes
- _____________________________________________________________________________
- Developer Technical Support
-
- #17: TbltDrvr
-
- Written by: Cameron Birse
-
- Versions: 1.00 April 1989
-
- Components: TbltDrvr.a April 1, 1989
- _____________________________________________________________________________
-
- 'ADBS' resources are loaded and executed at boot time (before INIT
- 31), and they are made of two main parts, the installation or
- initialization code and the the actual driver.
-
- In this example, the installation portion allocates memory in the
- system heap for the service routine and the “optional data area.”
- It installs the driver using the Apple Desktop Bus (ADB) Manager
- call _SetADBInfo.
-
- Generally speaking, ADB devices are intended to be user input
- devices. The ADB Manager polls the bus every 11 milliseconds to
- see if a device has new user input data. This polling is
- accomplished by sending a talk R0 command to the last active
- device. The last active device is the last device that had data
- to send to the host. If another device has data, it can request a
- poll by sending a service request signal to the host.
-
- When a device has responded to a poll, the ADB Manager will call
- the driver to process the data. This call is done a interrupt
- time (level 1), and the driver is passed the data, by getting a
- pointer to a Pascal string which contains the actual data.
-
- In this example, the data is in the form of a pointing device’s
- coordinates and button state. When the driver gets the data, it
- stores the coordinate information in RawMouse and MTemp. We stuff
- both RawMouse and MTemp, because the tablet is an “absolute”
- device. It also checks the state of the button against MBState,
- and if there has been a change, it will update MBState and post
- either a mouse-up or mouse-down event, as appropriate.
-
- Note: This code demonstrates how to move the cursor
- position. This information is meant for input
- device drivers only; this technique should not
- be used by applications to move the cursor.
- Moving the cursor is bad user interface, and
- nobody likes a bad user interface, so “Just Say No.”
-